{layout name="layout" /}
<div class="row">
    <div class="col-md-12">
        <div class="panel panel-default">
            <div class="panel-heading">友情链接添加</div>
            <div class="panel-body">
                <div class="row">
                    <div class="col-sm-8">
                        <form action="{:url('admin/aricle/add')}" class="form-horizontal ajax-form" method="post" name="rule">
                            <div class="form-group">

                                <label for="" class="col-sm-3 control-label">分类</label>
                                <div class="col-sm-4">
                                    <select name="category_id" class="form-control">
                                        <option value="0">请选择</option>
                                        {volist name="ariclecategoryRows" id="ariclecategoryRow"}
                                        <option value="{$ariclecategoryRow.id}">{$ariclecategoryRow.title}</option>
                                        {volist name="$ariclecategoryRow->parent" id="row"}
                                        <option value="{$row.id}">┗━{$row.title}</option>
                                        {volist name="$row->parent" id="r"}
                                        <option value="{$r.id}">&nbsp;&nbsp;┗━━━{$r.title}</option>
                                        {/volist}
                                        {/volist}
                                        {/volist}
                                    </select>
                                </div>
                            </div>

                            <div class="form-group">
                                <label for="inputname" class="col-sm-3 control-label">标题</label>
                                <div class="col-sm-5">
                                    <input type="text" class="form-control" name="title" id="inputname" placeholder="标题">
                                </div>
                            </div>

                            <div class="form-group">
                                <label for="" class="col-sm-3 control-label">缩略图</label>
                                <div class="col-sm-5">                                    
                                    <img src="{$default_image}" style="max-width:100px; max-height:100px;"  id="aricle-thumbnail"  class="img-circle upload">
                                    <input type="hidden" name="aricle-thumbnail" value="" />
                                </div>
                            </div>                            

                            <div class="form-group">
                                <label for="inputkeyword" class="col-sm-3 control-label">关键词</label>
                                <div class="col-sm-8">
                                    <input type="text" class="form-control" name="keyword" id="inputkeyword" placeholder="关键词">
                                </div>
                            </div>

                            <div class="form-group">
                                <label for="inputkeyword" class="col-sm-3 control-label">简介</label>
                                <div class="col-sm-8">
                                    <textarea name="description" class="form-control" ></textarea>
                                </div>
                            </div>
                            
                            <div class="form-group">
                                <label class="col-sm-3 control-label" for="inputSort"> 排序 </label>
                                <div class="col-sm-2">
                                    <input type="text" class="form-control " name="sort" value="255" id="inputSort" placeholder="越小越靠前">
                                </div>
                            </div>

                            <div class="form-group">
                                <label class="col-sm-3 control-label" for="inputstatus"> 是否启用 </label>
                                <div class="col-sm-5">
                                    <input type="checkbox" name="status" id="inputstatus" value="1" />
                                </div>
                            </div>

                            <div class="form-group">
                                <label class="col-sm-3 control-label" for="inputSort"> 内容 </label>
                                <div class="col-sm-9">
                                    <script charset="utf-8" src="/static/admin/js/kindeditor/kindeditor-all.js"></script>
                                    <script charset="utf-8" src="/static/admin/js/kindeditor/lang/zh-CN.js"></script>
                                    <textarea id="editor" name="content"></textarea>
                                    <script>
                                    KindEditor.ready(function(K) {
                                        window.editor = K.create('#editor', {
                                            themeType: 'simple',
                                            uploadJson: '{:url('admin/upload/uploadpic')}',
                                            width: '100%',
                                            height: '320px',
                                            items: [
                                                'fontname', 'fontsize', '|', 'forecolor', 'hilitecolor', 'bold', 'italic', 'underline',
                                                'removeformat', '|', 'justifyleft', 'justifycenter', 'justifyright', 'insertorderedlist',
                                                'insertunorderedlist', '|', 'emoticons', 'multiimage', 'link', '|', 'fullscreen'
                                            ]
                                        });
                                    });
                                    </script>
                                </div>
                            </div>
                                        
                            <div class="form-group">
                                <div class="col-sm-offset-3 col-sm-9">
                                    <button type="submit" class="btn btn-primary">提交</button>
                                </div>
                            </div>
                        </form>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
<script type="text/javascript">
$(function(argument) {
    $('form.ajax-form').formLuffyZhao([{
        name: "title",
        display: '标题',
        rules: 'required'
    },{
        name: "url",
        display: '链接地址',
        rules: 'required'
    }
    ]);

    $('.children').on('ifChecked',function (argument) {
         if(!$(this).parents('.widget-box').find('.father').is('checked')){
            $(this).parents('.widget-box').find('.father').iCheck('check');
         }
    });
});
</script>
